(global.webpackJsonp = global.webpackJsonp || []).push([ [ "xg_o2o/shop/shop" ], {
    "1dcc": function(t, e, i) {},
    "233c": function(t, e, i) {
        "use strict";
        i.r(e);
        var o = i("b2e4"), s = i("8cdf");
        for (var n in s) "default" !== n && function(t) {
            i.d(e, t, function() {
                return s[t];
            });
        }(n);
        i("f50a");
        var a = i("f0c5"), r = Object(a.a)(s.default, o.b, o.c, !1, null, null, null, !1, o.a, void 0);
        e.default = r.exports;
    },
    "3e2f": function(t, e, i) {
        "use strict";
        (function(t) {
            Object.defineProperty(e, "__esModule", {
                value: !0
            }), e.default = void 0;
            var i = {
                data: function() {
                    return {
                        graceFullLoading: !0,
                        loadingText: "...",
                        shop: {},
                        bgColor: "",
                        bottomColor: "",
                        isRelease: 1,
                        textColor: "",
                        iskefu: 2,
                        isSubmit: !1,
                        attach: "",
                        totalprice: 0,
                        freightprice: 0,
                        totalpriceFreight: 0,
                        creditprice: 0,
                        creditMember: 0,
                        goodsSelectList: [],
                        goodsSelect: "",
                        addressDetail: {},
                        orderAddrId: 0,
                        actionSheetItems: [],
                        trans: "",
                        transStyle: 1,
                        isFee: 0,
                        mainHeight: 500,
                        currentCateIndex: 1,
                        leftTo: "cate1",
                        productListTo: "",
                        mainCate: [],
                        allProducts: {},
                        allGoods: [],
                        scrollTimer: null,
                        tmplIds: [],
                        showBack: !1,
                        creditContent: "",
                        distributorId: 0
                    };
                },
                onLoad: function(e) {
                    var i = wx.getLaunchOptionsSync();
                    if (e.did > 0 && (this.distributorId = e.did), 1154 != i.scene) {
                        var o = getCurrentPages();
                        this.showBack = o.length > 1;
                        var s = this.$systemInfo.info();
                        this.mainHeight = s.windowHeight - s.iPhoneXBottomHeightPx - s.statusBarHeight - 45 - t.upx2px(380), 
                        e.did > 0 ? this.distributor(e.did) : this.getInfo();
                    } else this.loadingText = "请点击前往小程序";
                },
                onShow: function(e) {
                    var i = this;
                    t.$once("selectAddr", function(t) {
                        i.addressDetail = t.addressDetail, i.orderAddrId = t.addrid, i.addressLngLat = t.addressDetail.city;
                    });
                },
                onShareAppMessage: function(t) {
                    return {
                        title: this.shop.sharetitle ? this.shop.sharetitle : "积分与商城",
                        path: "/xg_o2o/shop/shop?did=" + this.distributorId,
                        imageUrl: this.shop.shareimg ? this.attach + this.shop.shareimg : ""
                    };
                },
                onShareTimeline: function(t) {
                    return {
                        title: this.shop.sharetitle ? this.shop.sharetitle : "积分与商城",
                        query: "did=" + this.distributorId,
                        imageUrl: this.shop.shareimg ? this.attach + this.shop.shareimg : ""
                    };
                },
                methods: {
                    distributor: function(e) {
                        var i = this, o = {
                            sessionid: "",
                            wxInfo: "1",
                            memberInfo: "1"
                        }, s = this.$xSign.sign("v4getopenid");
                        t.login({
                            provider: "weixin",
                            success: function(n) {
                                i.$xRequest.request({
                                    url: "entry/wxapp/v4getopenid",
                                    data: {
                                        code: n.code,
                                        xgsign: s,
                                        op: "distributor",
                                        distributorId: e
                                    },
                                    getSession: "no",
                                    success: function(s) {
                                        s.data.errno || (o.sessionid = s.data.data.sessionid, t.setStorageSync("userInfo", o), 
                                        s.data.data.status == e ? console.log("推广成功") : console.log("客户被他人绑定"), i.getInfo());
                                    }
                                });
                            },
                            fail: function() {
                                console.log("login fail");
                            }
                        });
                    },
                    showDialogContent: function() {
                        this.$refs.graceDialogContent.open();
                    },
                    closeDialogContent: function() {
                        this.$refs.graceDialogContent.hide();
                    },
                    getContent: function(t) {
                        var e = this;
                        this.creditContent = "";
                        var i = t.currentTarget.dataset.proid, o = this.$xSign.sign("u8shop");
                        this.$xRequest.request({
                            url: "entry/wxapp/u8shop",
                            data: {
                                xgsign: o,
                                opaction: "content",
                                proid: i
                            },
                            success: function(t) {
                                var i = JSON.parse(e.$Decrypt(t.data.data));
                                e.creditContent = i.content, e.showDialogContent();
                            },
                            fail: function(t) {}
                        });
                    },
                    toShopOrder: function() {
                        t.redirectTo({
                            url: "shoporder"
                        });
                    },
                    selected: function(e) {
                        this.trans = this.actionSheetItems[e].name, "门店自提" == this.trans ? this.transStyle = 1 : this.transStyle = 0, 
                        t.showToast({
                            title: "您选择了 : " + this.actionSheetItems[e].name,
                            icon: "none"
                        });
                    },
                    payConfirm: function() {
                        var e = this;
                        return this.isSubmit = !0, 0 == this.goodsSelectList.length ? (t.showToast({
                            title: "请先选择商品",
                            icon: "none",
                            mask: !0
                        }), void (this.isSubmit = !1)) : parseFloat(this.creditMember) < parseFloat(this.creditprice) ? (t.showToast({
                            title: "积分不足，您当前积分为：" + this.creditMember,
                            icon: "none",
                            mask: !0
                        }), void (this.isSubmit = !1)) : 0 == this.orderAddrId ? (t.showToast({
                            title: "请添加您的收货信息",
                            icon: "none",
                            mask: !0
                        }), void (this.isSubmit = !1)) : void t.showModal({
                            title: "提示",
                            content: "确定提交订单吗?",
                            success: function(i) {
                                if (i.confirm) {
                                    t.showLoading({
                                        title: "提交中",
                                        mask: !0
                                    }), 0 == e.transStyle && parseFloat(e.creditprice) < parseFloat(e.shop.credittrans / 100) && parseFloat(e.totalprice) < parseFloat(e.shop.paytrans / 100) ? (e.totalpriceFreight = e.floatAdd(e.totalprice, e.shop.freight / 100), 
                                    e.freightprice = e.shop.freight / 100) : (e.totalpriceFreight = e.totalprice, e.freightprice = 0);
                                    var o = e.$xSign.sign("u8creditpay");
                                    e.$xRequest.request({
                                        url: "entry/wxapp/u8creditpay",
                                        data: {
                                            xgsign: o,
                                            goodsSelect: e.goodsSelect,
                                            totalprice: e.totalprice,
                                            creditprice: e.creditprice,
                                            freightprice: e.freightprice,
                                            totalpriceFreight: e.totalpriceFreight,
                                            transtyle: e.transStyle,
                                            addid: e.orderAddrId,
                                            addrusername: e.addressDetail.username,
                                            addrmobile: e.addressDetail.mobile,
                                            addrname: e.addressDetail.district,
                                            addrdetail: e.addressDetail.province,
                                            addraddress: e.addressDetail.address,
                                            addrlatlng: e.addressDetail.city
                                        },
                                        success: function(i) {
                                            var o = JSON.parse(e.$Decrypt(i.data.data)), s = o.params;
                                            i.data && 1 == o.pay && !i.data.errno ? wx.requestPayment({
                                                timeStamp: s.timeStamp,
                                                nonceStr: s.nonceStr,
                                                package: s.package,
                                                signType: "MD5",
                                                paySign: s.paySign,
                                                success: function(i) {
                                                    t.showToast({
                                                        title: "支付成功",
                                                        icon: "none",
                                                        duration: 800,
                                                        mask: !0
                                                    }), e.tmplIds.length > 0 ? wx.requestSubscribeMessage({
                                                        tmplIds: e.tmplIds,
                                                        complete: function(e) {
                                                            setTimeout(function() {
                                                                t.hideLoading(), t.reLaunch({
                                                                    url: "shoporder"
                                                                });
                                                            }, 300);
                                                        }
                                                    }) : setTimeout(function() {
                                                        t.hideLoading(), t.reLaunch({
                                                            url: "shoporder"
                                                        });
                                                    }, 300);
                                                },
                                                fail: function(i) {
                                                    e.isSubmit = !1, "requestPayment:fail cancel" == i.errMsg && t.showToast({
                                                        title: "支付取消",
                                                        icon: "none",
                                                        duration: 800
                                                    });
                                                }
                                            }) : (t.showToast({
                                                title: "积分支付",
                                                icon: "none",
                                                duration: 300,
                                                mask: !0
                                            }), e.tmplIds.length > 0 ? wx.requestSubscribeMessage({
                                                tmplIds: e.tmplIds,
                                                complete: function(e) {
                                                    t.hideLoading(), t.reLaunch({
                                                        url: "shoporder"
                                                    });
                                                }
                                            }) : setTimeout(function() {
                                                t.hideLoading(), t.reLaunch({
                                                    url: "shoporder"
                                                });
                                            }, 300));
                                        },
                                        fail: function(i) {
                                            return t.hideLoading(), t.showToast({
                                                title: i.data.message,
                                                icon: "none",
                                                duration: 800,
                                                mask: !0
                                            }), e.isSubmit = !1, !1;
                                        }
                                    });
                                } else i.cancel && (e.isSubmit = !1, console.log("用户点击取消"));
                            }
                        });
                    },
                    getInfo: function() {
                        var e = this, i = this.$xSign.sign("u8shop");
                        this.$xRequest.request({
                            url: "entry/wxapp/u8shop",
                            data: {
                                xgsign: i
                            },
                            success: function(i) {
                                var o = JSON.parse(e.$Decrypt(i.data.data));
                                e.shop = o.set, 2 == e.shop.shopstatus && o.category.length > 0 ? (e.graceFullLoading = !1, 
                                e.mainCate = o.category, e.attach = o.attach, e.bgColor = o.bgColor, e.bottomColor = o.color, 
                                e.iskefu = o.iskefu, e.textColor = o.textColor, e.attach = o.attach, e.tmplIds = o.tmplIds, 
                                e.allProducts = o.goods, e.allGoods = o.allgoods, e.creditMember = o.credit, e.actionSheetItems = o.actionSheetItems, 
                                e.leftTo = "cate" + e.mainCate[0].id, e.currentCateIndex = e.mainCate[0].id, e.orderAddrId = o.orderAddrId, 
                                e.addressDetail = o.addressDetail, e.transStyle = o.transStyle, e.distributorId = o.distributorId) : 2 == e.shop.shopstatus ? (e.loadingText = "请先添加分类和商品", 
                                setTimeout(function() {
                                    t.navigateBack({});
                                }, 2e3)) : (e.loadingText = "商城功能未开启", setTimeout(function() {
                                    t.navigateBack({});
                                }, 2e3));
                            },
                            fail: function(t) {}
                        });
                    },
                    getMap: function() {
                        var e = this.shop.lnglat.split(",");
                        "" == e[0] ? t.showModal({
                            title: "温馨提示",
                            content: "地址错误，请联系客服",
                            showCancel: !1,
                            success: function(e) {
                                e.confirm && t.navigateBack({
                                    delta: 1
                                });
                            }
                        }) : t.openLocation({
                            latitude: Number(e[1]),
                            longitude: Number(e[0]),
                            success: function() {
                                console.log("success");
                            }
                        });
                    },
                    numberChange: function(e) {
                        if (e[0] < 0) t.showToast({
                            title: "数量错误",
                            icon: "none",
                            mask: !0
                        }); else if (1 == this.allGoods[e[2]].totalstatus && e[0] > this.allGoods[e[2]].total) t.showToast({
                            title: "库存不足",
                            icon: "none",
                            mask: !0
                        }); else {
                            if (this.allGoods[e[2]].goodscount = e[0], this.goodsSelectList.indexOf(e[2]) >= 0) {
                                if (e[0] <= 0) {
                                    var i = this.goodsSelectList.indexOf(e[2]);
                                    this.goodsSelectList.splice(i, 1);
                                }
                            } else this.goodsSelectList.push(e[2]);
                            this.countTotoal();
                        }
                    },
                    countTotoal: function() {
                        var t = 0, e = 0;
                        this.goodsSelect = "";
                        for (var i = 0; i < this.goodsSelectList.length; i++) {
                            var o = this.goodsSelectList[i];
                            if (t += this.accMul(this.allGoods[o].goodscount, this.allGoods[o].marketprice), 
                            e += this.accMul(this.allGoods[o].goodscount, this.allGoods[o].creditprice), t > 0 || e > 0) {
                                var s = this.allGoods[o].id + "," + this.allGoods[o].marketprice + "," + this.allGoods[o].creditprice + "," + this.allGoods[o].title + "," + this.allGoods[o].goodscount + "|";
                                this.goodsSelect += s;
                            }
                        }
                        this.totalprice = t.toFixed(2), this.creditprice = e.toFixed(2);
                    },
                    floatAdd: function(t, e) {
                        var i, o, s;
                        try {
                            i = t.toString().split(".")[1].length;
                        } catch (t) {
                            i = 0;
                        }
                        try {
                            o = e.toString().split(".")[1].length;
                        } catch (t) {
                            o = 0;
                        }
                        return s = Math.pow(10, Math.max(i, o)), Number(Math.round(t * s + e * s) / s);
                    },
                    accMul: function(t, e) {
                        var i = 0, o = t.toString(), s = e.toString();
                        try {
                            i += o.split(".")[1].length;
                        } catch (t) {}
                        try {
                            i += s.split(".")[1].length;
                        } catch (t) {}
                        return Number(o.replace(".", "")) * Number(s.replace(".", "")) / Math.pow(10, i);
                    },
                    rscroll: function(t) {
                        var e = this;
                        null != this.scrollTimer && clearTimeout(this.scrollTimer), this.scrollTimer = setTimeout(function() {
                            e.getIndex();
                        }, 100);
                    },
                    getIndex: function(e) {
                        var i = this, o = t.createSelectorQuery();
                        o.selectAll(".products").boundingClientRect(), o.selectViewport().scrollOffset(), 
                        o.exec(function(t) {
                            for (var e = t[0], o = 0; o < e.length; o++) if (e[o].top > 0 && e[o].top >= 250) return i.currentCateIndex = e[o].dataset.parentid, 
                            void (i.leftTo = "cate" + e[o].dataset.parentid);
                        });
                    },
                    changCate: function(t) {
                        var e = this, i = t.currentTarget.dataset.cateid;
                        this.currentCateIndex = i, 1 == i ? (this.productListTo = "productList2", this.$nextTick(function() {
                            e.productListTo = "productList" + i;
                        })) : this.productListTo = "productList" + i;
                    },
                    search: function(t) {
                        var e = t, i = -1;
                        for (var o in this.allProducts) {
                            for (var s = 0; s < this.allProducts[o].length; s++) if (-1 != this.allProducts[o][s].name.indexOf(e)) {
                                i = this.allProducts[o][s].productId;
                                break;
                            }
                            if (-1 != i) break;
                        }
                        -1 != i && (this.productListTo = "products" + i);
                    },
                    gotoinfo: function(e) {
                        t.showToast({
                            title: "商品id " + e
                        });
                    }
                }
            };
            e.default = i;
        }).call(this, i("543d").default);
    },
    "8cdf": function(t, e, i) {
        "use strict";
        i.r(e);
        var o = i("3e2f"), s = i.n(o);
        for (var n in o) "default" !== n && function(t) {
            i.d(e, t, function() {
                return o[t];
            });
        }(n);
        e.default = s.a;
    },
    b2e4: function(t, e, i) {
        "use strict";
        i.d(e, "b", function() {
            return s;
        }), i.d(e, "c", function() {
            return n;
        }), i.d(e, "a", function() {
            return o;
        });
        var o = {
            gracePage: function() {
                return i.e("graceUI/components/gracePage").then(i.bind(null, "1915"));
            },
            graceFullLoading: function() {
                return i.e("graceUI/components/graceFullLoading").then(i.bind(null, "7669"));
            },
            divider: function() {
                return i.e("components/divider/divider").then(i.bind(null, "bdb7"));
            },
            graceNumberBox: function() {
                return i.e("graceUI/components/graceNumberBox").then(i.bind(null, "6774"));
            },
            graceSelectTags: function() {
                return i.e("graceUI/components/graceSelectTags").then(i.bind(null, "1e05"));
            },
            graceDialog: function() {
                return i.e("graceUI/components/graceDialog").then(i.bind(null, "8d15"));
            }
        }, s = function() {
            this.$createElement, this._self._c;
        }, n = [];
    },
    c621: function(t, e, i) {
        "use strict";
        (function(t) {
            function e(t) {
                return t && t.__esModule ? t : {
                    default: t
                };
            }
            i("4e1e"), e(i("66fd")), t(e(i("233c")).default);
        }).call(this, i("543d").createPage);
    },
    f50a: function(t, e, i) {
        "use strict";
        var o = i("1dcc");
        i.n(o).a;
    }
}, [ [ "c621", "common/runtime", "common/vendor" ] ] ]);